package com.controller;

import com.github.pagehelper.PageHelper;
import com.pojo.User;
import com.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class UserConteroller {

    @Resource
    private UserService userService;

    @RequestMapping("/getUserAll1")
    @ResponseBody
    public List<User> getUserAll(){
        PageHelper.startPage(1,4);
        List<User> userAll = userService.getUserAll();
        return userAll;
    }

    @RequestMapping("/addUser")
    @ResponseBody
    public int addUser(){
        User user = new User();
        user.setUserName("lisitt");
        user.setUserPassword("123");
        int i = userService.addUseone(user);
        return i;
    }

    @RequestMapping("/getUserMsg")
    @ResponseBody
    public String getUserMsg(){
        return "getUserMsg";
    }
}
